package com.hzhr.extdevice.controller;

import com.hzhr.extdevice.model.database.v2.CollectDeviceV2;
import com.hzhr.extdevice.model.response.BaseResponse;
import com.hzhr.extdevice.util.IpUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;


@Api(value = "演示接口", description = "演示接口")
@RestController
public class TestController {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Value("${server.port}")
    private String port;


    @ApiOperation("获取服务器信息")
    @RequestMapping(value = "/serverinfo", method = RequestMethod.POST)
    Object getHostPort() throws Exception {
        String text = "Server IP:" + IpUtils.getServerIp() + "\nServer port: " + port;

//        UserExample userExample = new UserExample();
//        userExample.createCriteria().andIsvalidEqualTo(1);
//        List<User> users = this.userMapper.selectByExample(userExample);
//        EquipCollectExample equipCollectExample = new EquipCollectExample();
//        equipCollectExample.createCriteria().andIdEqualTo(1000000);
//        EquipCollect equipCollect = TConverter.GetFirstOrDefualt(this.equipCollectMapper.selectByExample(equipCollectExample));
//
//        CollectDeviceV2 collectDeviceV2 = rService.convertEquipCollect(equipCollect);
//        HashMap<String,String[]> searchMap=new HashMap<>();
//        searchMap.put("EQUAL_id",new String[]{String.valueOf(1000000)});
//
//        rService.delelte(collectDeviceV2);
//        rService.insert(collectDeviceV2);
//        String json =  rService.search(collectDeviceV2, 1, 1,searchMap, null, null);

        return new BaseResponse("0", "成功", text);
    }
}
